﻿Class Interrupt_TC001
    Inherits seTelnet
    Private InterruptFileName As String
    Sub New(ByVal ip As String, ByVal FileName As String)
        MyBase.New(ip)
        Me.InterruptFileName = FileName
    End Sub
    Public Overrides Function runStep(ByVal loginStep As Integer, ByVal sectionStr As String) As RunStepMsg
        Select Case loginStep
            Case 0
                If (sectionStr.EndsWith("login: ")) Then
                    MyBase.SocketSend("admin" & vbCrLf)

                    Return RunStepMsg.nextStep
                End If
            Case 1
                If (sectionStr.EndsWith("Password: ")) Then
                    MyBase.SocketSend("admin" & vbCrLf)

                    Return RunStepMsg.nextStep
                End If
            Case 2
                If (sectionStr.EndsWith("\> ")) Then
                    MyBase.SocketSend("ps -a " + Me.InterruptFileName & vbCrLf)

                    Return RunStepMsg.nextStep
                End If

            Case 3
                ' If (sectionStr.Contains("Killed") Or sectionStr.EndsWith("\> ")) Then
                'If (sectionStr.Contains("Killed")) Then
                '    Return RunStepMsg.RunEnd
                '    'Else
                '    '    'Return RunStepMsg.Fail
                'End If
                If (sectionStr.Contains("can't kill")) Then
                    Return RunStepMsg.Fail
                Else
                    Return RunStepMsg.RunEnd
                End If

            Case Else


        End Select
        Return RunStepMsg.wait
    End Function
End Class